import type { RowData } from 'naive-ui/es/data-table/src/interface';
import { isFunction, isString } from 'lodash-es';

export function useColorType(value: any, rowData: RowData, colorType: ColorDecisionFunction | ColorType | undefined) {
  let type: ColorType = 'default';
  if (isString(colorType)) {
    type = colorType;
  } else if (isFunction(colorType)) {
    type = colorType(value, rowData);
  }

  return type;
}
